package edu.shu.hellospringboot.controller;

import edu.shu.hellospringboot.pojo.Account;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


@Controller
@RequestMapping("/hello")
public class HellospringbootController {

    @ResponseBody
    @RequestMapping("/testController")
    public String testController()
    {
        return "hello,springboot";
    }


    @RequestMapping("/testForward")
    public String testForward(Model model)
    {
        model.addAttribute("msg","哈哈哈哈哈哈");
        return "hello";
    }

    @RequestMapping("/testData")
    @ResponseBody
    public String testData(Account account)
    {
        System.out.println(account);
        return "成功";
    }
}
